package leetcode_2301_2400;

import java.util.HashMap;
import java.util.Map;

public class LeeCode_2399 {
    public static void main(String[] args) {

    }
    public boolean checkDistances(String s, int[] distance) {
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (map.containsKey(c)){
                if (i - map.get(c) - 1 == distance[c - 'a']){
                    continue;
                }else
                    return false;
            }
            map.put(c, i);
        }
        return true;
    }
}
